import 'package:flutter/material.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import '../help/cabinet_help.dart';

class CabinetFormBottomCustomCheck extends StatelessWidget {
  final Function(CabinetDateType type)? selectAction;
  const CabinetFormBottomCustomCheck({
    super.key,
    this.selectAction,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          width: double.infinity,
          margin: EdgeInsets.only(bottom: 10),
          child: Text(
            "交易时间",
            style: TextStyle(color: MGColors.text3Color, fontSize: MGFont.textFont3),
          ),
        ),
        Row(
          children: [
            _textButton(
                title: "近3月",
                action: () {
                  if (selectAction != null) {
                    selectAction!(CabinetDateType.threeMonth);
                  }
                }),
            _textButton(
                title: "近半月",
                action: () {
                  if (selectAction != null) {
                    selectAction!(CabinetDateType.halfYear);
                  }
                }),
            _textButton(
                title: "近一年",
                action: () {
                  if (selectAction != null) {
                    selectAction!(CabinetDateType.oneYear);
                  }
                }),
          ],
        )
      ],
    );
  }

  Widget _textButton({required String title, Function()? action}) {
    return InkWell(
      child: Container(
        padding: EdgeInsets.only(left: 20, right: 20, top: 6, bottom: 6),
        margin: EdgeInsets.only(right: 10),
        decoration: BoxDecoration(color: MGColors.backColor, borderRadius: BorderRadius.circular(4)),
        child: Text(title),
      ),
      onTap: action,
    );
  }
}
